home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-05 | 3.9 KB | 194 lines | [TEXT/MMCC] |
- // CAMReminderApp.cp -- application methods
- // Created 10/5/95 4:49 PM by AppMaker
-
- #include "CAMReminderApp.h"
-
- #include "CAMReminderDoc.h"
- #include "CAMReminderData.h"
- #include "CmdCodes.h"
-
- #include <UDesktop.h>
- #include <URegistrar.h>
- #include <UScreenPort.h>
- #include <PPobClasses.h>
- #include <PP_Messages.h>
-
- // ---------------------------------------------------------------------------
- // • CAMReminderApp
- // ---------------------------------------------------------------------------
- // Default constructor
-
- CAMReminderApp::CAMReminderApp()
- :LDocApplication()
- {
- UScreenPort::Initialize();
-
- RegisterClasses();
-
- SetUpMenus();
-
- // initialize app's data:
-
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~CAMReminderApp
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- CAMReminderApp::~CAMReminderApp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • RegisterClasses
- // ---------------------------------------------------------------------------
- //
-
- void
- CAMReminderApp::RegisterClasses()
- {
- RegisterAllPPClasses();
- // replace to register only classes that we use.
- // windows know what classes they use
- // so call static functions in each window/dialog,
- }
-
- // ---------------------------------------------------------------------------
- // • SetUpMenus
- // ---------------------------------------------------------------------------
- //
-
- void
- CAMReminderApp::SetUpMenus()
- {
-
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
- // The application calls this member function automatically when the application
- // is opened
-
- void
- CAMReminderApp::StartUp()
- {
- ObeyCommand(cmd_Open, nil);
- }
-
- //----------
- LModelObject*
- CAMReminderApp::MakeNewDocument()
- {
- CAMReminderDoc *theDoc = new CAMReminderDoc(this);
-
- theDoc->newFile();
-
- return theDoc;
- }
-
- //----------
- // called from SendAEOpenDoc in response to Open command
-
- void
- CAMReminderApp::OpenDocument(
- FSSpec *inMacFSSpec)
- {
- CAMReminderDoc *theDoc = new CAMReminderDoc(this);
-
- theDoc->openFile (inMacFSSpec);
- }
-
- //----------
- // called from LDocApplication in response to Open command
-
- void
- CAMReminderApp::ChooseDocument()
- {
- SFTypeList typeList;
- short numTypes;
- StandardFileReply macFileReply;
-
- typeList[0] = kFileType;
- numTypes = 1;
-
- UDesktop::Deactivate();
- ::StandardGetFile(nil, numTypes, typeList, &macFileReply);
- UDesktop::Activate();
-
- if (macFileReply.sfGood) {
- SendAEOpenDoc(macFileReply.sfFile);
- }
- }
-
- //----------
- void
- CAMReminderApp::DoDeleteReminder ()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- CAMReminderApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
- // Remember to add same cases to FindCommandStatus below
- // to enable/disable the menu items for the commands
-
-
- case cmdDeleteReminder:
- DoDeleteReminder ();
- break;
-
- default:
- cmdHandled = LDocApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // Pass back status of a (menu) command
-
- void
- CAMReminderApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- case cmdDeleteReminder:
- outEnabled = true;
- break;
-
- default:
- LDocApplication::FindCommandStatus(inCommand, outEnabled, outUsesMark,
- outMark, outName);
- break;
- }
- }
-